<script setup>
import {onLoad} from '@dcloudio/uni-app';
import { ref} from 'vue'
import * as Api from '/api/questions'
let rearingList1 = ref([])
let rearingList2 = ref([])
let rearingList3 = ref([])
onLoad(async ()=>{
  let res = await Api.getSubmissionList(1)
  let res1 = await Api.getSubmissionList(2)
  let res2= await Api.getSubmissionList(3)
  rearingList1.value = res.data
  rearingList2.value = res1.data
  rearingList3.value = res2.data
})
const goRearingDetail1 = (title,id) => {
  uni.navigateTo({
    url: `/pages/index/questions?type=2&title=${title}&id=${id}`
  })
}
const goRearingDetail2 = (title,id) => {
  uni.navigateTo({
    url: `/pages/index/questions?type=3&title=${title}&id=${id}`
  })
}
const goRearingDetail3 = (title,id) => {
  uni.navigateTo({
    url: `/pages/index/questions?type=4&title=${title}&id=${id}`
  })
}

const godateil = (title,type,tid) => {
  if (type === 1){
    common.taskQuestionids =
    uni.navigateTo({
      url: `/pages/task/taskT/taskT?type=${type}&tid=${tid}&title=${title}`
    })
  }else if (type === 2){
    uni.navigateTo({
      url: `/pages/test/jlp/jlp?type=${type}&tid=${tid}&title=${title}`
    })
  }else if (type === 3){
    uni.navigateTo({
      url: `/pages/task/taskT/taskT?type=${type}&tid=${tid}&title=${title}`
    })
  }

}
</script>
<template>
  <view style="padding: 20rpx 0;">
    <van-tabs type="card" color = '#0AD192'>
      <van-tab title="作业">
        <scroll-view scroll-y>
          <view @click="godateil(item.title,1,item.id)" v-for="item in rearingList1" style="box-shadow: 0 0 10rpx rgba(0,0,0,0.1);margin: 20rpx auto;width: 700rpx;height:80rpx;font-size: 28rpx;color: #7c7c7c;border-radius: 10rpx;display: flex;align-items: center;justify-content: space-around;background-color: white;padding: 10rpx;">
            <view style="width: 600rpx">{{item.title}}</view>
            <van-icon name="arrow" />
          </view>
        </scroll-view>

      </van-tab>
      <van-tab title="整卷">
        <scroll-view scroll-y>
          <view @click="godateil(item.title,2,item.bankId)" v-for="item in rearingList2" style="box-shadow: 0 0 10rpx rgba(0,0,0,0.1);margin: 20rpx auto;width: 700rpx;height:80rpx;border-radius: 10rpx;font-size: 28rpx;color: #7c7c7c;display: flex;align-items: center;justify-content: space-around;background-color: white;padding: 10rpx;">
            <view style="width: 600rpx">{{item.title}}</view>
            <van-icon name="arrow" />
          </view>
        </scroll-view>
      </van-tab>
      <van-tab title="专题">
        <scroll-view scroll-y>
          <view @click="goRearingDetail3(item.title,item.id)" v-for="item in rearingList3" style="box-shadow: 0 0 10rpx rgba(0,0,0,0.1);margin: 20rpx auto;width: 700rpx;height:80rpx;font-size: 28rpx;color: #7c7c7c;border-radius: 10rpx;display: flex;align-items: center;justify-content: space-around;background-color: white;padding: 10rpx;">
            <view style="width: 600rpx">{{item.title}}</view>
            <van-icon name="arrow" />
          </view>
        </scroll-view>
      </van-tab>
    </van-tabs>
  </view>

</template>




<style scoped>

</style>
